#pragma once

#include <QWidget>

#include "Bridge.h"

class QMenu;
class StdSearchListView;
class SearchListView;
class SymbolSearchList;
class HyperTraceManager;
class QVBoxLayout;

namespace Ui {
class HyperTraceView;
}

class HyperTraceView : public QWidget {
  Q_OBJECT

 public:
  explicit HyperTraceView(QWidget* parent = 0);
  ~HyperTraceView() override;
  void setupContextMenu();

 private slots:
  void updateStyle();
  void addMsgToSymbolLogSlot(QString msg);
  void clearSymbolLogSlot();
  void moduleSelectionChanged(int index);
  void updateSymbolList(int module_count, SYMBOLMODULEINFO* modules);
  void symbolDecompile();
  void symbolFollow();
  void symbolFollowDump();
  void symbolFollowImport();
  void symbolSelectModule(duint base);
  void enterPressedSlot();
  void symbolContextMenu(QMenu* wMenu);
  void symbolRefreshCurrent();
  void moduleContextMenu(QMenu* wMenu);
  void moduleFollow();
  void moduleEntryFollow();
  void moduleDownloadSymbols();
  void moduleDownloadAllSymbols();
  void moduleCopyPath();
  void moduleBrowse();
  void toggleBreakpoint();
  void toggleBookmark();
  void refreshShortcutsSlot();
  void emptySearchResultSlot();
  void selectionGetSlot(SELECTIONDATA* selection);
  void moduleLoad();
  void moduleFree();
  void refreshList();
  void funcSelectionChanged(int index);

 signals:
  void showReferences();

 private:
  Ui::HyperTraceView* ui;
  QVBoxLayout* mMainLayout;
  QVBoxLayout* mSymbolLayout;
  HyperTraceManager* mMgrView;
  QWidget* mSymbolPlaceHolder;
  SearchListView* mSymbolList;
  StdSearchListView* mModuleList;
  SymbolSearchList* mSymbolSearchList;
  QMap<QString, duint> mModuleBaseList;
  QAction* mDecompileSymbolAction;
  QAction* mFollowSymbolAction;
  QAction* mFollowSymbolDumpAction;
  QAction* mFollowSymbolImportAction;
  QAction* mToggleBreakpoint;
  QAction* mToggleBookmark;
  QAction* mFollowModuleAction;
  QAction* mFollowModuleEntryAction;
  QAction* mDownloadSymbolsAction;
  QAction* mDownloadAllSymbolsAction;
  QAction* mCopyPathAction;
  QAction* mRefreshAction;
  QAction* mBrowseInExplorer;
  QMenu* mPluginMenu;
};
